home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / gg / gengetopt-2.6.lha / gengetopt-2.6 / doc / main2.c < prev    next >
C/C++ Source or Header  |  2001-06-24  |  747b  |  42 lines

  1. /* sample2.c */
  2.  
  3. /* If we use autoconf.  */
  4. #ifdef HAVE_CONFIG_H
  5. #    include "config.h"
  6. #endif
  7. /* Check for configure's getopt check result.  */
  8. #ifndef HAVE_GETOPT_LONG
  9. #    include "getopt.h"
  10. #else
  11. #    include <getopt.h>
  12. #endif
  13.  
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16.  
  17. #include "cmdline2.h"
  18.  
  19. int
  20. main (int argc, char **argv)
  21. {
  22.   struct gengetopt_args_info args_info;
  23.  
  24.   /* let's call our cmdline parser */
  25.   if (my_cmdline_parser (argc, argv, &args_info) != 0)
  26.     exit(1) ;
  27.  
  28.   if (args_info.help_given)
  29.     {
  30.       printf ("This is a simple test for gengetopt\n");
  31.       my_cmdline_parser_print_help ();
  32.     }
  33.  
  34.   if (args_info.version_given)
  35.     {
  36.       printf ("Here is the version\n");
  37.       my_cmdline_parser_print_version ();
  38.     }
  39.  
  40.   return 0;
  41. }
  42.